
* Table 3
* ALL (top panel)
qui{
clear
use "Experiments Stata Files/Experiment0.dta"
append using "Experiments Stata Files/Experiment05.dta"
append using "Experiments Stata Files/Experiment06.dta"

* indicator if person survived to 65
drop if age>65
bysort experiment ID: egen max_age = max(age)
gen Survived_65= 0 if max_age<65
replace Survived_65=1 if max_age==65
drop max_age
replace Survived_65=. if age>25 //  we only want one observation per person. 
drop if age==65

gen I_H_good= 0 if H==1 | H==2
replace I_H_good=1 if H==3


bysort experiment ID: egen max_HC = max(human_capital_prime)
replace max_HC =. if age>25 //want one obs per person

gen MTC=MC_orig*.6

collapse (mean) MC sick_days Survived_65 I_H_good employed_yn max_HC TR wage_offer Value , by(experiment)
replace TR=TR*100
replace Survived_65=Survived_65*100
replace employed_yn=employed_yn*100
replace I_H_good=I_H_good*100

drop Value
* open data and copy paste into table, all rows and columns are in order
}


* HS only (bottom panel)
qui{
clear
use "Experiments Stata Files/Experiment0.dta"
append using "Experiments Stata Files/Experiment05.dta"
append using "Experiments Stata Files/Experiment06.dta"

keep if education==1
* indicator if person survived to 65
drop if age>65
bysort experiment ID: egen max_age = max(age)
gen Survived_65= 0 if max_age<65
replace Survived_65=1 if max_age==65
drop max_age
replace Survived_65=. if age>25 //  we only want one observation per person. 
drop if age==65

gen I_H_good= 0 if H==1 | H==2
replace I_H_good=1 if H==3

bysort experiment ID: egen max_HC = max(human_capital_prime)
replace max_HC =. if age>25 //want one obs per person

gen MTC=MC_orig*.6

collapse (mean) MC sick_days Survived_65 I_H_good employed_yn max_HC TR wage_offer Value , by(experiment)
replace TR=TR*100
replace Survived_65=Survived_65*100
replace employed_yn=employed_yn*100
replace I_H_good=I_H_good*100

drop Value

* open data and copy paste into table, all rows and columns are in order
}

